package com.yc.cloud.admin.dto.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 人脸检测响应DTO
 *
 * @author JackGu
 * @since 2025-11-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "人脸检测响应DTO")
public class FaceDetectRespDTO extends BaseFaceResponse<FaceDetectRespDTO.DetectData> {

    /**
     * 检测数据
     */
    @Data
    @ApiModel(value = "检测数据")
    public static class DetectData {
        @ApiModelProperty(value = "检测到的人脸数量")
        @JsonProperty("face_count")
        private Integer faceCount;

        @ApiModelProperty(value = "人脸列表")
        private List<FaceInfo> faces;

        @ApiModelProperty(value = "匹配结果（当进行人脸比对时）")
        @JsonProperty("match_result")
        private MatchResult matchResult;
    }

    /**
     * 人脸信息
     */
    @Data
    @ApiModel(value = "人脸信息")
    public static class FaceInfo {

        @ApiModelProperty(value = "人脸边界框")
        @JsonProperty("bounding_box")
        private BoundingBox boundingBox;

        @ApiModelProperty(value = "人脸置信度（0-1）")
        private Float confidence;

        @ApiModelProperty(value = "人脸特征向量")
        private List<Float> embedding;
    }

    /**
     * 人脸边界框
     */
    @Data
    @ApiModel(value = "人脸边界框")
    public static class BoundingBox {

        @ApiModelProperty(value = "左上角X坐标")
        private Integer x;

        @ApiModelProperty(value = "左上角Y坐标")
        private Integer y;

        @ApiModelProperty(value = "宽度")
        private Integer width;

        @ApiModelProperty(value = "高度")
        private Integer height;
    }

    /**
     * 匹配结果
     */
    @Data
    @ApiModel(value = "人脸匹配结果")
    public static class MatchResult {

        @ApiModelProperty(value = "是否匹配成功")
        @JsonProperty("is_match")
        private Boolean isMatch;

        @ApiModelProperty(value = "相似度（0-1）")
        private Float similarity;

        @ApiModelProperty(value = "匹配的人脸ID")
        @JsonProperty("face_id")
        private String faceId;

        @ApiModelProperty(value = "匹配的人脸名称")
        @JsonProperty("face_name")
        private String faceName;
    }
}

